package day21;

import java.util.Scanner;

/**
 * 功能描述
 *
 * @author wileda
 * @date 2023/03/29  7:57
 */
public class Solution {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int num = scanner.nextInt();//歌曲数量
            String str = scanner.next();//命令
            if (num <= 4) {
                map3Low4(str, num);
            } else {
                map3Up4(str, num);
            }
        }
    }

    private static void map3Up4(String str, int num) {
        char[] ch = str.toCharArray();
        int begin = 1;
        int cur = 1;
        for (int i = 0; i < ch.length; i++) {
            if (begin == 1 && cur == 1 && ch[i] == 'U') {
                cur = num;
                begin = num - 3;
                continue;
            }
            if (begin == num - 3 && cur == num && ch[i] == 'D') {
                cur = 1;
                begin = 1;
                continue;
            }
            if (ch[i] == 'U' && begin == cur) {
                cur -= 1;
                begin -= 1;
                continue;
            }
            if (ch[i] == 'D' && begin + 3 == cur) {
                cur += 1;
                begin += 1;
                continue;
            }
            if (ch[i] == 'U') {
                cur -= 1;
            }else {
                cur += 1;
            }
        }
        System.out.println(begin + " " + (begin + 1) + " " + (begin + 2) + " " +
                (begin + 3));
        System.out.println(cur);
    }

    private static void map3Low4(String str, int num) {
        char[] ch = str.toCharArray();
        int begin = 1;
        int cur = 1;
        for (int i = 0; i < ch.length; i++) {
            if (cur == 1 && ch[i] == 'U') {
                cur = num;
                continue;
            }
            if (cur == num && ch[i] == 'D') {
                cur = 1;
                continue;
            }
            if (ch[i] == 'U') {
                cur -= 1;
            }
            if (ch[i] == 'D') {
                cur += 1;
            }
        }
        for (int i = 0; i < num; i++) {
            if (i == 0) {
                System.out.print(begin);
            } else {
                System.out.print(" " + (begin + i));
            }
        }
        System.out.println();
        System.out.println(cur);
    }
}
